<?php 
include TMPL_PATH.'public/header.phtml';
?>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href='<?php echo U('attribute/model_list');?>'><em>产品类型管理</em></a><span>|</span>
        <a href='<?php echo U('attribute/attribute_list', 'modelid='.$modelid);?>'><em><?php echo $model_name;?>-属性列表</em></a><span>|</span>
        <a href='javascript:;' class="on"><em><?php echo $attribute['attr_name'];?> - 属性值列表</em></a><span>|</span>
        <a href='<?php echo U('attribute/attribute_values_add', array('modelid'=>$modelid,'attrid'=>$attribute['attr_id']));?>' ><em>添加属性值</em></a></div>
</div>
<div class="pad_10">
<div class="table-list">
    <table width="100%" cellspacing="0" >
        <thead>
            <tr>
            <th width="100">ID</th>
            <th align='left' width="200">图片</th>
            <th align='left' width="200">属性值名称</th>
            <th align='center' width="100">附加费用</th>
            <th align='center' width="100">状态</th>
            <th align='center' width="100">排序</th>
						<th>管理操作</th>
            </tr>
        </thead>
     <tbody>
   <?php 
   	if(isset($attributeValuesList) && $attributeValuesList):
   		foreach ($attributeValuesList as $v):
   ?>
			<tr>
					<td align='center'><?php echo $v['id']?></td>
					<td><?php if($v['attr_img']){?><img src="<?php echo $v['attr_img']?>" height="50"/><?php }?></td>
					<td><?php echo $v['attr_value']?></td>
					<td align='center'><?php echo $v['add_money']?$v['add_money']:0.00?>$</td>
					<td align='center'><?php echo ($v['is_down']==1)?"上架中":"<font color='red'>下架中</font>";?></td>
                    <td align='center'><?php echo $v['sort_order']?></td>
					<td align='center' > 
					<a href="<?php echo U('attribute/attribute_values_edit', array('modelid'=>$modelid,'attrid'=>$attribute['attr_id'],'attvalid'=>$v['id']));?>">修改</a>&nbsp;&nbsp;|&nbsp;&nbsp;
                    <a href="javascript:void(0);" onclick="return confirm_down('<?php echo $v['product_idss'];?>','<?php echo $modelid;?>','<?php echo $attribute['attr_id'];?>','<?php echo $v['id'];?>');"><?php echo ($v['is_down']==1)?"下架":"上架";?></a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<a href="javascript:void(0);" onclick="return confirm_delete('<?php echo $v['product_ids'];?>','<?php echo $modelid;?>','<?php echo $attribute['attr_id'];?>','<?php echo $v['id'];?>');">删除</a>
					</td>
				</tr>
	<?php 
		endforeach;
		endif;
	?>
   </tbody>
    </table>
</div>
</div>
</body>
</html>
<script type="text/javascript">
<!--
	function edit(modelid, attrid, attvalid, name) {
		window.top.art.dialog({title:'修改--'+name+'--属性值', id:'edit', iframe:'<?php echo U('attribute/attribute_values_edit');?>&modelid='+modelid+'&attrid='+attrid+'&attvalid='+attvalid ,width:'600px',height:'500px'}, 	function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;
		var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
	}
function add(modelid, attrid) {
	window.top.art.dialog({title:'添加 --<?php echo $attribute_name;?>--属性值', id:'add', iframe:'<?php echo U('attribute/attribute_values_add');?>&modelid='+modelid+'&attrid='+attrid ,width:'600px',height:'500px'}, 	function(){var d = window.top.art.dialog({id:'add'}).data.iframe;
	var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'add'}).close()});
}
function confirm_down(val,modelid,attrid,attvalid){
	if(val==""){
		if(confirm('你确认要下架该属性?')){
			var url="<?php echo U('attribute/attribute_values_down');?>"+"&modelid="+modelid+"&attrid="+attrid+"&attvalid="+attvalid;
			window.location.href=url;
		}
	}else{
		if(confirm("相关属性的产品选项的ID有"+val+'  你确认要下架该属性?')){
			var url="<?php echo U('attribute/attribute_values_down');?>"+"&modelid="+modelid+"&attrid="+attrid+"&attvalid="+attvalid;
			window.location.href=url;
		}
	}
}
function confirm_delete(val,modelid,attrid,attvalid){
	if(val==""){
		if(confirm('确认要删除?')){
			var url="<?php echo U('attribute/attribute_values_delete');?>"+"&modelid="+modelid+"&attrid="+attrid+"&attvalid="+attvalid;
			window.location.href=url;
		}
	}else{
		alert("默认产品选项的ID有"+val);
		//window.location.href="<?php echo U('attribute/plists');?>&pids="+val+"&attr_id="+attvalid+"&modelid="+modelid+"&attrid="+attrid;
		window.location.href="<?php echo U('product/plists');?>&pids="+val;
	}
}
//-->
</script>